Three.js: DataTexture
#Three.js
データからテクスチャを作っちゃおう
シェーダへのデータの受け渡しによく使う
DataTexture.needsUpdate のセットし忘れによる事故が毎年5000件以上発生しているので気をつけてください
https://threejs.org/docs/#api/en/textures/DataTexture
https://github.com/mrdoob/three.js/blob/master/src/textures/DataTexture.js
code:js
const texture = new THREE.DataTexture(
data, // typed array, usually Uint8Array
width,
height,
THREE.RedFormat, // THREE.RGBAFormat by default
THREE.FloatType, // THREE.UnsignedByteType by default
);
texture.needsUpdate = true;